package com.zr.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.zr.service.AddCarStateService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Controller
@Scope(value="prototype")
public class AddCarStateAction implements ServletResponseAware{
	private ServletResponse req;	
	@Override
	public void setServletResponse(HttpServletResponse Response) {
		this.req=Response;
		
	}

	
	@Resource
	private AddCarStateService addcarservice;
	public void selectState(){
		req.setCharacterEncoding("utf8");
JSONArray jw=addcarservice.findState();
		
		PrintWriter ps;
		try {
			ps = req.getWriter();
			ps.write(jw.toString());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}				 
	}
	public void selectPosition(){
		req.setCharacterEncoding("utf8");
		JSONArray jj=addcarservice.findPosition();
		try {
			PrintWriter ps=req.getWriter();
			ps.write(jj.toString());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public void selectPlate(){
		req.setCharacterEncoding("utf8");
		JSONArray jj=addcarservice.findPlate();
		try {
			PrintWriter ps=req.getWriter();
			ps.write(jj.toString());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public void selectOrderstatus(){
		req.setCharacterEncoding("utf8");
		JSONArray jj=addcarservice.findOrderstatus();
		try {
			PrintWriter ps=req.getWriter();
			ps.write(jj.toString());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
